﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MapLibrary.Players.CollisionResponse;
using MapLibrary.Players;

namespace MapLibrary.CollisionResponse
{
    /// <summary>
    /// How a player should behave when colliding with the floor
    /// </summary>
    public class JumpUpdateBehavior : CollisionBehavior
    {
        bool containedLastFrame;
        Player player;

        public JumpUpdateBehavior(Player p) : base()
        {
            player = p;
            containedLastFrame = false;
        }

        public override void Update(bool contained)
        {
            if (contained)
            {
                //was in the air, now landing
                if (!containedLastFrame)
                {
                    //player.Type.CurrentState = "Landing";
                    player.EnterStateWithProperDirection("Landing");
                }

                player.NumberJumps = 0;
            }

            containedLastFrame = contained;
        }
    }
}
